//
//  AFHttpTool.h
//  RCloud_liv_demo
//
//  Created by Liv on 14-10-22.
//  Copyright (c) 2014年 RongCloud. All rights reserved.
//


#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger, RequestMethodType){
    RequestMethodTypePost = 1,
    RequestMethodTypeGet = 2
};

@interface AFHttpTool : NSObject<UIAlertViewDelegate>

/**
 *  发送一个请求
 *
 *  @param methodType   请求方法
 *  @param url          请求路径
 *  @param params       请求参数
 *  @param success      请求成功后的回调(请将请求成功后想做的事情写到这个block中)
 *  @param failure      请求失败后的回调(请将请求失败后想做的事情写到这个block中)
 */
+(void) requestWihtMethod:(RequestMethodType)methodType
                      url:(NSString *)url
                   params:(NSDictionary *)params
                  success:(void (^)(id response))success
                  failure:(void (^)(NSError *err))failure;

/*
 *上传文件
 */
+(void) FileServletWithTaskId:(NSString *) taskId
                     Position:(NSString *) position
                        Image:(UIImage*)image
                         Type:(NSString *)type
                         Time:(NSString *)time
                      success:(void (^)(id response))success
                      failure:(void (^)(NSError* err))failure;


/*
 *登录
 */
+(void) loginWithLoginName:(NSString *) loginName
             LoginPassword:(NSString *) loginPassword
                  DeviceNo:(NSString *) deviceNo
                   success:(void (^)(id response))success
                   failure:(void (^)(NSError* err))failure;

/*
 *工作提醒
 */
+(void) queryMessagesWithRows:(NSString *) rows
                        Order:(NSString *) order
                MessageStatus:(NSString *) messageStatus
                      StartId:(NSString *) startId
                      success:(void (^)(id response))success
                      failure:(void (^)(NSError* err))failure;

/*
 *工作提醒更新状态
 */
+(void) updateMessageWithMessageId:(NSString *) messageId
                           success:(void (^)(id response))success
                           failure:(void (^)(NSError* err))failure;

/*
 *查看存量项目
 */
+(void)getProjectStockWithPage:(NSString *)page
                       success:(void (^)(id response))success
                       failure:(void (^)(NSError *err))failure;

/*
 *查看在审项目
 */
+(void)getProjectJudgeWithPage:(NSString *)page
                  ProjectStage:(NSString *)projectStage
                       success:(void (^)(id response))success
                       failure:(void (^)(NSError *err))failure;

/*
 *根据flowTypeId获取待办业务列表
 */
+(void)getTaskListWithFlowTypeId:(NSString *)flowTypeId
                         success:(void (^)(id response))success
                         failure:(void (^)(NSError *err))failure;
/*
 *获取待办业务列表单个详情
 */
+(void)getTaskDeatilWithFlowTypeId:(NSString *)flowTypeId
                            TaskId:(NSString *)taskId
                        WorkItemId:(NSString *)workItemId
                           success:(void (^)(id response))success
                           failure:(void (^)(NSError *err))failure;

/*
 *根据flowTypeId获取经手业务列表
 */
+(void)getPassTaskWithPage:(NSString *)page
                  flowType:(NSString *)flowType
                   success:(void (^)(id response))success
                   failure:(void (^)(NSError *err))failure;

/*
 *获取经手业务列表单个详情
 */
+(void)passTaskDetailWithProInstId:(NSString *)proInstId
                          PassType:(NSString *)passType
                           success:(void (^)(id response))success
                           failure:(void (^)(NSError *err))failure;

/*
 *提交/批准/否决按钮
 */
+(void)flowSubmitWithFlowContextId:(NSString *)flowContextId
                  OptFlowContextId:(NSString *)optFlowContextId
                      TargetUserId:(NSString *)targetUserId
                     TargetUserId1:(NSString *)targetUserId1
                      WorkItemName:(NSString *)workItemName
                             ToAdd:(NSString *)toAdd
                           success:(void (^)(id response))success
                           failure:(void (^)(NSError *err))failure;

+(void)flowSubmitWithFlowContextId:(NSString *)flowContextId
                  OptFlowContextId:(NSString *)optFlowContextId
                      TargetUserId:(NSString *)targetUserId
                      WorkItemName:(NSString *)workItemName
                             ToAdd:(NSString *)toAdd
                           success:(void (^)(id response))success
                           failure:(void (^)(NSError *err))failure;

//http://localhost:8080/lbms/dc/SmsAction.do?operAtt=flowBackManager&param={"FlowContextId":"AR:455520","optFlowContextId":"AR:455515","UserId":"48000000034"}

/*
 *退回到业务部按钮
 */
+(void)flowBackManagerWithFlowContextId:(NSString *)flowContextId
                       OptFlowContextId:(NSString *)optFlowContextId
                                success:(void (^)(id response))success
                                failure:(void (^)(NSError *err))failure;

/*
 *退回按钮
 */
+(void)flowBackWithFlowContextId:(NSString *)flowContextId
                OptFlowContextId:(NSString *)optFlowContextId
             TargetFlowContextId:(NSString *)targetFlowContextId
                    TargetUserId:(NSString *)targetUserId
                        BackType:(NSString *)backType
                     BackOpinion:(NSString *)backOpinion
                         success:(void (^)(id response))success
                         failure:(void (^)(NSError *err))failure;




/*
 *通过appContextId和flowContextId获取详情
 */
+(void)getInfoWithAppContextId:(NSString *)appContextId
                 FlowContextId:(NSString *)flowContextId
                       success:(void (^)(id response))success
                       failure:(void (^)(NSError *err))failure;

/*
 *通过flowTypeId获取详情
 */
+(void)getInfoWithFlowTypeId:(NSString *)flowTypeId
                     success:(void (^)(id response))success
                     failure:(void (^)(NSError *err))failure;

/*
 *保存岗位意见
 */
+(void)saveOpinionWithFlowContextId:(NSString *)flowContextId
                            Opinion:(NSString *)opinion
                              State:(NSString *)state
               isTallyWithComTactic:(NSString *)isTallyWithComTactic
                            explain:(NSString *)explain
                        projectflow:(NSString *)projectflow
                   prjPrimaryScheme:(NSString *)prjPrimaryScheme
                      schemeExplain:(NSString *)schemeExplain
                            success:(void (^)(id response))success
                            failure:(void (^)(NSError *err))failure;

/*
 *业务单元附件查询
 */
+(void)getDownLoadListWithFlowContextId:(NSString *)flowContextId
                                 TaskId:(NSString *)taskId
                                success:(void (^)(id response))success
                                failure:(void (^)(NSError *err))failure;


/*
 *项目尽调附件查询
 */
+(void)getFileListforCheckWithProjectId:(NSString *)projectId
                                success:(void (^)(id response))success
                                failure:(void (^)(NSError *err))failure;


/*
 *放款面签附件查询
 */
+(void)getDownLoadListWithContractId:(NSString *)contractId
                             success:(void (^)(id response))success
                             failure:(void (^)(NSError *err))failure;

/*
 *附件预览
 */
+(void)getDownLoadFileWithFlowContextId:(NSString *)path
                                success:(void (^)(id response))success
                                failure:(void (^)(NSError *err))failure;
/*
 *附件保存
 */
+(void)getSaveFileWithFlowContextId:(NSString *)flowContextId
                             taskId:(NSString*)taskId
                            FileIds:(NSString*)fileIds
                            success:(void (^)(id response))success
                            failure:(void (^)(NSError *err))failure;
/*
 *会议纪要
 */
+(void)getInfoWithAppContextIdT:(NSString *)appContextId
                        TasskId:(NSString *)taskId
                        success:(void (^)(id response))success
                        failure:(void (^)(NSError *err))failure;
/*
 *条件汇总
 */
+(void)getconditionCollectWithAppContextIdT:(NSString *)appContextId
                                    TasskId:(NSString *)taskId
                              FlowContextId:(NSString*)flowContextId
                                    success:(void (^)(id response))success
                                    failure:(void (^)(NSError *err))failure;
/*
 *条件汇总附件列表
 */
+(void)getqueryConditionCollectWithId:(NSString *)id
success:(void (^)(id response))success
failure:(void (^)(NSError *err))failure;
/*
 *待办条数
 */
+(void)getqueryDaibansuccess:(void (^)(id response))success
                     failure:(void (^)(NSError *err))failure;
/*
 *放款面签附件保存
 */
+(void)getsaveLoanSignRegistWithContractId:(NSString *)contractId
                                    FileId:(NSString *)fileId
                                      Type:(NSString *)type
                                   success:(void (^)(id response))success
                                   failure:(void (^)(NSError *err))failure;
/*
 *取消按钮
 */
+(void)abortWithFlowContextId:(NSString *)flowContextId
                      success:(void (^)(id response))success
                      failure:(void (^)(NSError *err))failure;

/*
 *权限控制
 */
+(void)queryPersistsuccess:(void (^)(id response))success
                   failure:(void (^)(NSError *err))failure;

/*
 *最终确认更还状态
 */
+(void)updateContStatusFileIds:(NSString *)fileIds
                   EffectState:(NSString *)effectState
                       success:(void (^)(id response))success
                       failure:(void (^)(NSError *err))failure;

/*
 * 附件删除
 */
+(void)fileDeleteWithFileId:(NSString *)fileId
                       Type:(NSString *)type
                    success:(void (^)(id response))success
                    failure:(void (^)(NSError *err))failure;

/*
 * 附件确认
 */
+(void)fileConfirmWithFileId:(NSString *)fileId
                        Type:(NSString *)type
                  FileStatus:(NSString *)fileStatus
                     success:(void (^)(id response))success
                     failure:(void (^)(NSError *err))failure;
@end

